<%@ page import="com.erpanderp.pr.model.entity.User" %>



<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'employeeNumber', 'error')} ">
	<label for="employeeNumber">
		<g:message code="user.employeeNumber.label" default="Employee Number" />
		
	</label>
	<g:textField name="employeeNumber" value="${userInstance?.employeeNumber}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'password', 'error')} required">
	<label for="password">
		<g:message code="user.password.label" default="Password" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="password" name="password" required="" value="${userInstance?.password}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'firstName', 'error')} required">
	<label for="firstName">
		<g:message code="user.firstName.label" default="First Name" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="firstName" required="" value="${userInstance?.firstName}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'lastName', 'error')} ">
	<label for="lastName">
		<g:message code="user.lastName.label" default="Last Name" />
		
	</label>
	<g:textField name="lastName" value="${userInstance?.lastName}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'email', 'error')} ">
	<label for="email">
		<g:message code="user.email.label" default="Email" />
		
	</label>
	<g:field type="email" name="email" value="${userInstance?.email}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'securityQuestion', 'error')} ">
	<label for="securityQuestion">
		<g:message code="user.securityQuestion.label" default="Security Question" />
		
	</label>
	<g:select name="securityQuestion" from="${userInstance.constraints.securityQuestion.inList}" value="${userInstance?.securityQuestion}" valueMessagePrefix="user.securityQuestion" noSelection="['': '']"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'securityAnswer', 'error')} required">
	<label for="securityAnswer">
		<g:message code="user.securityAnswer.label" default="Security Answer" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="securityAnswer" required="" value="${userInstance?.securityAnswer}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'status', 'error')} ">
	<label for="status">
		<g:message code="user.status.label" default="Status" />
		
	</label>
	<g:select name="status" from="${userInstance.constraints.status.inList}" value="${userInstance?.status}" valueMessagePrefix="user.status" noSelection="['': '']"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'createdBy', 'error')} ">
	<label for="createdBy">
		<g:message code="user.createdBy.label" default="Created By" />
		
	</label>
	<g:textField name="createdBy" value="${userInstance?.createdBy}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'lastUpdatedBy', 'error')} ">
	<label for="lastUpdatedBy">
		<g:message code="user.lastUpdatedBy.label" default="Last Updated By" />
		
	</label>
	<g:textField name="lastUpdatedBy" value="${userInstance?.lastUpdatedBy}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'purchaseRequests', 'error')} ">
	<label for="purchaseRequests">
		<g:message code="user.purchaseRequests.label" default="Purchase Requests" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${userInstance?.purchaseRequests?}" var="p">
    <li><g:link controller="purchaseRequest" action="show" id="${p.id}">${p?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="purchaseRequest" action="create" params="['user.id': userInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'purchaseRequest.label', default: 'PurchaseRequest')])}</g:link>
</li>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'roleName', 'error')} ">
	<label for="roleName">
		<g:message code="user.roleName.label" default="Role Name" />
		
	</label>
	<g:textField name="roleName" value="${userInstance?.roleName}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: userInstance, field: 'userRoles', 'error')} ">
	<label for="userRoles">
		<g:message code="user.userRoles.label" default="User Roles" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${userInstance?.userRoles?}" var="u">
    <li><g:link controller="userRole" action="show" id="${u.id}">${u?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="userRole" action="create" params="['user.id': userInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'userRole.label', default: 'UserRole')])}</g:link>
</li>
</ul>

</div>

